package com.leyou.exception;

import com.leyou.exception.pojo.BusinessExceptionEnum;

/**
 * 业务异常
 */
public class BusinessException extends RuntimeException{
    private static final long serialVersionUID = -9143318966769662666L;

    private Integer code;
    private String msg;

    /**
     * Constructs a new runtime exception with {@code null} as its
     * detail message.  The cause is not initialized, and may subsequently be
     * initialized by a call to {@link #initCause}.
     */
    public BusinessException(BusinessExceptionEnum businessExceptionEnum) {
        this.code = businessExceptionEnum.getCode();
        this.msg = businessExceptionEnum.getMsg();
    }

    public BusinessException(String msg){
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
